package com.jingdianjichi.oss.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.jingdianjichi.oss.service.FileService;
import com.jingdianjichi.oss.util.MinioUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RefreshScope
public class FileController {


    @Resource
    FileService fileService;
    @Value(value = "${storage.service.type}")
    private String storageType;
//    @NacosValue(value = "${storage.service.type}",autoRefreshed = true)
//    private String storageType;
    @RequestMapping("/getAllBucket")
    public String getAllBucket()throws Exception{
        List<String> allBucket = fileService.getAllBucket();
        return allBucket.get(0);
    }

    @RequestMapping("/testNacos")
    public String testNacos()throws Exception{

        return storageType;
    }

}
